<?php

namespace App\Wechat\Remind\Controllers;

use App\Exceptions\Error;
use App\Wechat\Remind\Library\Response;
use App\Wechat\Remind\Logics\Ticket;
use Illuminate\Support\Facades\Validator;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class TicketController extends Controller
{
	public function store(Request $request)
	{
		$validator = Validator::make($request->all(), [
			'form_id' => 'required|max:255'
		]);
		if ($validator->fails()){
			throw new ApiException('参数错误，请确认', Error::PARAMS_ERROR);
		}
		$result = (new Ticket())->store($request->post('form_id'));
		return Response::json($result);
    }
}
